package com.fingard.dsp.bank.reqrespobj.elecbilltrans;

import com.fingard.dsp.bank.reqrespobj.ReqRespHeader;
import com.fingard.dsp.bank.reqrespobj.RequestBase;
import com.fingard.dsp.bank.reqrespobj.elecbilltrans.detail.ReqB113ProtocolSubmitDetail;
import com.fingard.xml.XmlTextReader;

/**
 * Created by F on 2019/5/21.
 */
public class ReqB113ProtocolSubmit extends RequestBase {
    public ReqB113ProtocolSubmitDetail detail;
    public String protocolNo;
    public String totalAmount;
    public String totalNum;
    public String reqBatchNo;
    public String creditLv;
    public String gradeAgent;
    public String gradeDueDate;
    public String reqReserve1;
    public String reqReserve2;
    private XmlTextReader xmlReader;

    public ReqB113ProtocolSubmit(XmlTextReader p_xmlReader, ReqRespHeader p_header) throws Exception {
        reqHeader = p_header;
        xmlReader = p_xmlReader;
        protocolNo = xmlReader.getSimpleText("ProtocolNo");
        totalAmount = xmlReader.getSimpleText("TotalAmount");
        totalNum = xmlReader.getSimpleText("TotalNum");
        reqBatchNo = xmlReader.getSimpleText("ReqBatchNo");
        creditLv = xmlReader.getSimpleText("CreditLv");
        gradeAgent = xmlReader.getSimpleText("GradeAgent");
        gradeDueDate = xmlReader.getSimpleText("GradeDueDate");
        reqReserve1 = xmlReader.getSimpleText("ReqReserve1");
        reqReserve2 = xmlReader.getSimpleText("ReqReserve2");
        //用于日志命名
        reqHeader.reqSeqID = reqBatchNo;
    }

    public boolean readRecord() throws Exception {
        detail = null;
        if (xmlReader.read(PATH_Detail)) {
            detail = new ReqB113ProtocolSubmitDetail(xmlReader.readedXElement);
            return true;
        } else {
            return false;
        }
    }
}
